package com.example.x6.configurationmaintenance.Activity;

import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.support.annotation.Nullable;
import android.widget.SeekBar;
import com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference;
import com.example.x6.configurationmaintenance.R;
import com.example.x6.configurationmaintenance.Utils.SuCommand;

public class OverscanActivity extends PreferenceActivity {
    private MySeekBarPreference bottomOverscan;
    String bottomValue = null;
    private MySeekBarPreference leftOverscan;
    String leftValue = null;
    private Preference resetOverscan;
    private MySeekBarPreference rightOverscan;
    String rightValue = null;
    private MySeekBarPreference topOverscan;
    String topValue = null;

    /* access modifiers changed from: protected */
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.overscan);
        initView();
    }

    private void initView() {
        this.leftOverscan = (MySeekBarPreference) getPreferenceScreen().findPreference(getResources().getString(R.string.left_overscan));
        this.topOverscan = (MySeekBarPreference) getPreferenceScreen().findPreference(getResources().getString(R.string.top_overscan));
        this.rightOverscan = (MySeekBarPreference) getPreferenceScreen().findPreference(getResources().getString(R.string.right_overscan));
        this.bottomOverscan = (MySeekBarPreference) getPreferenceScreen().findPreference(getResources().getString(R.string.bottom_overscan));
        this.resetOverscan = getPreferenceScreen().findPreference(getResources().getString(R.string.reset_overscan));
        this.leftOverscan.setMax(200);
        this.topOverscan.setMax(200);
        this.rightOverscan.setMax(200);
        this.bottomOverscan.setMax(200);
        this.leftOverscan.setDefaultProgressValue(100);
        this.topOverscan.setDefaultProgressValue(100);
        this.rightOverscan.setDefaultProgressValue(100);
        this.bottomOverscan.setDefaultProgressValue(100);
        this.leftOverscan.setOnSeekBarPrefsChangeListener(new MySeekBarPreference.OnSeekBarPrefsChangeListener() {
            /* class com.example.x6.configurationmaintenance.Activity.OverscanActivity.AnonymousClass1 */

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStopTrackingTouch(String key, SeekBar seekBar) {
                OverscanActivity.this.overscan();
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStartTrackingTouch(String key, SeekBar seekBar) {
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onProgressChanged(String key, SeekBar seekBar, int progress, boolean fromUser) {
            }
        });
        this.topOverscan.setOnSeekBarPrefsChangeListener(new MySeekBarPreference.OnSeekBarPrefsChangeListener() {
            /* class com.example.x6.configurationmaintenance.Activity.OverscanActivity.AnonymousClass2 */

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStopTrackingTouch(String key, SeekBar seekBar) {
                OverscanActivity.this.overscan();
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStartTrackingTouch(String key, SeekBar seekBar) {
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onProgressChanged(String key, SeekBar seekBar, int progress, boolean fromUser) {
            }
        });
        this.rightOverscan.setOnSeekBarPrefsChangeListener(new MySeekBarPreference.OnSeekBarPrefsChangeListener() {
            /* class com.example.x6.configurationmaintenance.Activity.OverscanActivity.AnonymousClass3 */

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStopTrackingTouch(String key, SeekBar seekBar) {
                OverscanActivity.this.overscan();
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStartTrackingTouch(String key, SeekBar seekBar) {
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onProgressChanged(String key, SeekBar seekBar, int progress, boolean fromUser) {
            }
        });
        this.bottomOverscan.setOnSeekBarPrefsChangeListener(new MySeekBarPreference.OnSeekBarPrefsChangeListener() {
            /* class com.example.x6.configurationmaintenance.Activity.OverscanActivity.AnonymousClass4 */

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStopTrackingTouch(String key, SeekBar seekBar) {
                OverscanActivity.this.overscan();
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onStartTrackingTouch(String key, SeekBar seekBar) {
            }

            @Override // com.example.x6.configurationmaintenance.MyPreference.MySeekBarPreference.OnSeekBarPrefsChangeListener
            public void onProgressChanged(String key, SeekBar seekBar, int progress, boolean fromUser) {
            }
        });
        this.resetOverscan.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            /* class com.example.x6.configurationmaintenance.Activity.OverscanActivity.AnonymousClass5 */

            public boolean onPreferenceClick(Preference preference) {
                OverscanActivity.this.resetOverscan();
                return true;
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void resetOverscan() {
        this.leftOverscan.setProgress(100);
        this.topOverscan.setProgress(100);
        this.rightOverscan.setProgress(100);
        this.bottomOverscan.setProgress(100);
        new SuCommand().execRootCmd("wm overscan reset");
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void overscan() {
        new SuCommand().execRootCmdSilent("wm overscan " + String.valueOf(this.leftOverscan.getProgress() - 100) + "," + String.valueOf(this.topOverscan.getProgress() - 100) + "," + String.valueOf(this.rightOverscan.getProgress() - 100) + "," + String.valueOf(this.bottomOverscan.getProgress() - 100));
    }
}
